package com.efast.dmom.mgmt.controller.wms;

import com.efast.cafe.framework.bean.ResultBean;
import com.efast.dmom.mgmt.entity.wms.TwBasPartRuleHeader;
import com.efast.dmom.mgmt.service.wms.TwBasPartRuleHeaderService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping(value="/partRuleHeader")
public class TwBasPartRuleHeaderController {
	@Autowired
	private TwBasPartRuleHeaderService twBasPartRuleHeaderService;

	// 零件规则头配置保存
	@RequestMapping(value = "/save")
	public @ResponseBody ResultBean save(@RequestBody TwBasPartRuleHeader twBasPartRuleHeader){
		ResultBean result=new ResultBean(true,"'");
		try {
			String msg = twBasPartRuleHeaderService.insertPartRule(twBasPartRuleHeader);
			if("201".equals(msg)) {
				result.setSuccess(false);
				result.setMessage("零件规则已存在！");
			}
		} catch (Exception e) {
			result.setSuccess(false);
			e.printStackTrace();
		}
		return result;
	}
}
